home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
gm.h.z
/
gm.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
6KB
|
196 lines
#ifndef __SYS_GM_H__
#define __SYS_GM_H__
/**************************************************************************
* *
* Copyright (C) 1989, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#ident "$Revision: 3.45 $"
/*
* Status structure for GM and pipe
*/
typedef struct gm_status_s {
/* board level status */
int gms_flag; /* bit flags */
/* I/O addresses (VME addresses expressed in K1SEG form) */
#if defined(IP5) || defined(IP17)
caddr_t gms_trig_addr; /* Trigger for 3-way transfer */
caddr_t gms_tagram_addr;/* MP address of tag SRAM */
#endif
caddr_t gms_dram_base; /* Base of GM DRAM (a32 space) */
caddr_t gms_pipe_base; /* Base of the FIFO (a32 space) */
gm_ioreg_t gms_iobase; /* GM i/o registers (a16 space) */
host_to_gm_comm_t *gms_hostcomm_p; /* pointers to comm areas in DRAM */
gm_to_host_comm_t *gms_gmcomm_p;
gm_shared_t *gms_shared_p;
unchar gms_vme_vec; /* VME interrupt vector for GM */
int gms_pflag; /* status flags for the pipe */
int gms_cxid; /* active context id in pipe */
caddr_t gms_recvp; /* kernel address for GM command response */
int gms_recvlen; /* length of response buffer */
int gms_error; /* set if GM command fails in some way */
sema_t gms_wait; /* semaphore for GM command acknowledge */
sema_t gms_abort; /* semaphore for GM abort command acknowledge */
lock_t gms_lock; /* lock to protect gm_status */
#if defined(IP5) || defined(IP17)
sema_t gms_gmcmd; /* to provide exclusive use for GM cmds */
sema_t gms_dmawait; /* for suspending process waiting for dma */
int gms_xferlen; /* length in bytes transferred */
#endif /* IP5 */
int gms_accumcount; /* number of accumulation buffer users */
} gm_status_t;
extern gm_status_t gm_status;
/*
* Values for gm_status_t.gms_flag
*/
#define GM_INITIALIZED 0x0001 /* board initialized */
#define GM_WINMGR 0x0002 /* window manager present */
#define GM_WAITACK 0x0004 /* process waiting for ACK */
#define GM_RESPONSE 0x0008 /* GM response contained data */
#define GM_DEAD 0x0010 /* the GM has timed out */
#define GM_DMA_INUSE 0x0020 /* pixel buffer dma in progress */
#define GM_DMA_WAIT 0x0040 /* waiting for dma */
#define GM_DMA_WANT 0x0080 /* some process wants to do dma */
#define GM_DMA_ERR 0x0100 /* error on current dma */
#define GM_DIAG_BUSY 0x0200 /* diag channel cmd in progress */
/*
* Values for gm_status_t.gms_pflag
*/
#define GM_PIPE_HOST 0x0001 /* the host can write to the FIFO */
#define GM_PIPE_SWITCHING 0x0002 /* context switch in progress */
#define GM_PIPE_SWITCHED 0x0004 /* context switch complete */
/*
* Values for p_graph.g_mapmode
*/
#define GM_MODE_GRAPH 0 /* loaded context is for graphics */
#define GM_MODE_VECTOR 1 /* loaded context is for vector lib */
/*
* Comm area pointers
*/
#define HOST_TO_GM_COMM_P (&(((struct gm_dram_s *)(gm_status.gms_dram_base))->host_to_gm_comm))
#define GM_TO_HOST_COMM_P (&(((struct gm_dram_s *)(gm_status.gms_dram_base))->gm_to_host_comm))
#define GM_SHARED_P (&(((struct gm_dram_s *)(gm_status.gms_dram_base))->gm_shared_data))
/*
|| Data structure corresponding to a graphics context on the GM board
*/
typedef struct gm_context_s {
unchar cx_flag; /* state flags */
struct graph_s *cx_graph; /* graphics info struct */
int cx_feedcount; /* feedback chars copied to userbuf */
caddr_t cx_feedbackp; /* kernel address of feedback region */
caddr_t cx_storebuf; /* kernel address of unload buffer */
int cx_storebuflen; /* length of unload buffer */
int cx_storecount; /* unload buffer count copied back */
int cx_waiters; /* counter of suspended procs */
sema_t cx_wait; /* semaphore to suspend procs */
caddr_t cx_texshadow; /* pointer to texture shadow struct */
caddr_t cx_texmap; /* user addr of current texture map */
long cx_npixels; /* number of pixels in texture map */
long cx_texcompress; /* texture map is in compressed format*/
int cx_screen; /* screen number associated with cxt */
int cx_accumbuffer; /* context is using accumulation buf */
lock_t cx_lock; /* spinlock to protect this entry */
} gm_context_t;
extern gm_context_t gm_context[];
/*
* Values for gm_context_t.cx_flag
*/
#define GM_CX_SWAP_PENDING 0x0001 /* swap buffers pending */
#define GM_CX_PICKING 0x0002 /* pick/select in progress */
#define GM_CX_FEEDBACK 0x0004 /* feedback operation in progress */
#define GM_CX_UNLOAD 0x0008 /* context unload in progress */
#define GM_CX_OVERFLOW 0x0010 /* pick/select buffer too small */
#define GM_CX_NOTAKE 0x0020 /* not eligible for TAKECX */
/*
* Structure to remember locked memory
*/
typedef struct gm_lockmap_s {
caddr_t buffer; /* user address */
int buflen; /* length */
struct gm_lockmap_s *next; /* linked list pointer */
} gm_lockmap_t;
extern gr_out_t gm_funcs;
extern int store_cx_buf[4096];
/*
* Macros
*/
#if defined(IP5) || defined(IP17)
#define SPLGM spl5 /* this actually sets spl4 */
#else IP4
#define SPLGM splvme
#define GM_UNLOAD_AREA (statp->gms_dram_base + GM_UNLOAD_OFFSET)
#endif
#ifndef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
/* OP argument to gm_rectop */
#define PIXREAD 0
#define PIXWRITE 1
/*
* GM-dependent function pointers
*/
typedef struct gm_out_s {
int (*gm_sgigsc)();
int (*gm_wmsgigsc)();
int (*gm_switch_cx)();
void (*gm_cmd)();
void (*gm_dma_pixels)();
void (*gm_texcleanup)();
} gm_out_t;
extern gm_out_t *gm_out_p;
/*
* Prototypes for exported functions in gm.c
*/
int gm_common_init(struct edt *, int);
int gm_get_comm(gm_status_t *);
void gm_send_cmd(gm_status_t *, int);
void gm_unmapreg(struct graph_s *);
void gm_invaltlb(struct proc *);
void gm_cx_sleep(gm_context_t *, int);
void gm_cx_wakeup(gm_context_t *);
void gm_dma_lock(gm_status_t *, struct graph_s *);
void gm_dma_unlock(gm_status_t *);
int gm_cx_check(struct proc *, int);
void gm_error(gm_status_t *);
int gm_output_str(caddr_t, int);
gm_status_t *gm_get_statp();
gm_context_t *gm_get_contextp();
#endif /* __SYS_GM_H__ */